package cn.ml.chuji.game.che;

public class KeChe extends Che {
    private int zuo;

    public KeChe(String xingHao, String chePai, int riZhuJin, int zuo) {
        super(xingHao, chePai, riZhuJin);
        this.zuo = zuo;
    }

    public KeChe() {
    }

    public int getZuo() {
        return zuo;
    }

    public void setZuo(int zuo) {
        this.zuo = zuo;
    }

    @Override
    public double pay(int tian) {
        double qian;
        qian = getRiZhuJin() * tian;
        double tmp = qian;
        if(tian >= 3){
            qian = tmp * 0.9;
        }if (tian >= 7){
            qian = tmp * 0.8;
        }if(tian >= 30){
            qian = tmp * 0.7;
        }if(tian >= 15){
            qian = tian * 0.6;
        }
        return qian;
    }

    @Override
    public String toString() {
        return "客车{" +
                "型号='" + getXingHao() + '\'' +
                ", 车牌='" + getChePai() + '\'' +
                ", 日租金=" + getRiZhuJin() +'\'' +
                "座=" + zuo +
                '}';
    }
}
